import sys

def svmlbl(inpath, outpath, lbl):
    fin = open(inpath,'r')
    fout = open(outpath,'w')
    for line in fin:
        if line.find(' ') == -1: #skip this line
            continue 
        s,f = line.split(' ',1)
        fout.write(lbl+' ')
        fout.write(f)
    fin.close()
    fout.close()

if __name__=='__main__':
    if len(sys.argv) < 4:
        print 'usage:',sys.argv[0],'<input>','<output>','<label>'
        sys.exit()
    svmlbl(sys.argv[1],sys.argv[2],sys.argv[3])
